home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / PInterfaces / ADSP.p next >
Encoding:
Text File  |  1998-08-17  |  8.6 KB  |  234 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        ADSP.p
  3.  
  4.      Contains:    AppleTalk Data Stream Protocol (ADSP) Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1986-1998, 1995-1997 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. }
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT ADSP;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __ADSP__}
  27. {$SETC __ADSP__ := 1}
  28.  
  29. {$I+}
  30. {$SETC ADSPIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33. {$IFC UNDEFINED __ERRORS__}
  34. {$I Errors.p}
  35. {$ENDC}
  36. {$IFC UNDEFINED __APPLETALK__}
  37. {$I AppleTalk.p}
  38. {$ENDC}
  39.  
  40.  
  41. {$PUSH}
  42. {$ALIGN MAC68K}
  43. {$LibExport+}
  44.  
  45. {driver control csCodes}
  46.  
  47. CONST
  48.     dspInit                        = 255;                            {  create a new connection end  }
  49.     dspRemove                    = 254;                            {  remove a connection end  }
  50.     dspOpen                        = 253;                            {  open a connection  }
  51.     dspClose                    = 252;                            {  close a connection  }
  52.     dspCLInit                    = 251;                            {  create a connection listener  }
  53.     dspCLRemove                    = 250;                            {  remove a connection listener  }
  54.     dspCLListen                    = 249;                            {  post a listener request  }
  55.     dspCLDeny                    = 248;                            {  deny an open connection request  }
  56.     dspStatus                    = 247;                            {  get status of connection end  }
  57.     dspRead                        = 246;                            {  read data from the connection  }
  58.     dspWrite                    = 245;                            {  write data on the connection  }
  59.     dspAttention                = 244;                            {  send an attention message  }
  60.     dspOptions                    = 243;                            {  set connection end options  }
  61.     dspReset                    = 242;                            {  forward reset the connection  }
  62.     dspNewCID                    = 241;                            {  generate a cid for a connection end  }
  63.  
  64.                                                                 {  connection opening modes  }
  65.     ocRequest                    = 1;                            {  request a connection with remote  }
  66.     ocPassive                    = 2;                            {  wait for a connection request from remote  }
  67.     ocAccept                    = 3;                            {  accept request as delivered by listener  }
  68.     ocEstablish                    = 4;                            {  consider connection to be open  }
  69.  
  70.                                                                 {  connection end states  }
  71.     sListening                    = 1;                            {  for connection listeners  }
  72.     sPassive                    = 2;                            {  waiting for a connection request from remote  }
  73.     sOpening                    = 3;                            {  requesting a connection with remote  }
  74.     sOpen                        = 4;                            {  connection is open  }
  75.     sClosing                    = 5;                            {  connection is being torn down  }
  76.     sClosed                        = 6;                            {  connection end state is closed  }
  77.  
  78.                                                                 {  client event flags  }
  79.     eClosed                        = $80;                            {  received connection closed advice  }
  80.     eTearDown                    = $40;                            {  connection closed due to broken connection  }
  81.     eAttention                    = $20;                            {  received attention message  }
  82.     eFwdReset                    = $10;                            {  received forward reset advice  }
  83.  
  84.                                                                 {  miscellaneous constants  }
  85.     attnBufSize                    = 570;                            {  size of client attention buffer  }
  86.     minDSPQueueSize                = 100;                            {  Minimum size of receive or send Queue  }
  87.  
  88. { connection control block }
  89.  
  90. TYPE
  91.     TRCCBPtr = ^TRCCB;
  92.     TPCCB                                = ^TRCCB;
  93.     TRCCB = PACKED RECORD
  94.         ccbLink:                TPCCB;                                    {  link to next ccb  }
  95.         refNum:                    UInt16;                                    {  user reference number  }
  96.         state:                    UInt16;                                    {  state of the connection end  }
  97.         userFlags:                UInt8;                                    {  flags for unsolicited connection events  }
  98.         localSocket:            UInt8;                                    {  socket number of this connection end  }
  99.         remoteAddress:            AddrBlock;                                {  internet address of remote end  }
  100.         attnCode:                UInt16;                                    {  attention code received  }
  101.         attnSize:                UInt16;                                    {  size of received attention data  }
  102.         attnPtr:                Ptr;                                    {  ptr to received attention data  }
  103.         reserved:                PACKED ARRAY [0..219] OF UInt8;            {  for adsp internal use  }
  104.     END;
  105.  
  106. {$IFC TYPED_FUNCTION_POINTERS}
  107.     ADSPConnectionEventProcPtr = PROCEDURE(sourceCCB: TPCCB);
  108. {$ELSEC}
  109.     ADSPConnectionEventProcPtr = Register68kProcPtr;
  110. {$ENDC}
  111.  
  112. {$IFC TYPED_FUNCTION_POINTERS}
  113.     ADSPCompletionProcPtr = PROCEDURE(thePBPtr: DSPPBPtr);
  114. {$ELSEC}
  115.     ADSPCompletionProcPtr = Register68kProcPtr;
  116. {$ENDC}
  117.  
  118.     ADSPConnectionEventUPP = UniversalProcPtr;
  119.     ADSPCompletionUPP = UniversalProcPtr;
  120.     DSPParamBlockPtr = ^DSPParamBlock;
  121.     DSPParamBlock = PACKED RECORD
  122.         qLink:                    QElemPtr;
  123.         qType:                    INTEGER;
  124.         ioTrap:                    INTEGER;
  125.         ioCmdAddr:                Ptr;
  126.         ioCompletion:            ADSPCompletionUPP;
  127.         ioResult:                OSErr;
  128.         ioNamePtr:                StringPtr;
  129.         ioVRefNum:                INTEGER;
  130.         ioCRefNum:                INTEGER;                                {  adsp driver refNum  }
  131.         csCode:                    INTEGER;                                {  adsp driver control code  }
  132.         qStatus:                LONGINT;                                {  adsp internal use  }
  133.         ccbRefNum:                INTEGER;
  134.         CASE INTEGER OF
  135.         0: (
  136.             ccbPtr:                TPCCB;                                    {  pointer to connection control block  }
  137.             userRoutine:        ADSPConnectionEventUPP;                    {  client routine to call on event  }
  138.             sendQSize:            UInt16;                                    {  size of send queue (0..64K bytes)  }
  139.             sendQueue:            Ptr;                                    {  client passed send queue buffer  }
  140.             recvQSize:            UInt16;                                    {  size of receive queue (0..64K bytes)  }
  141.             recvQueue:            Ptr;                                    {  client passed receive queue buffer  }
  142.             attnPtr:            Ptr;                                    {  client passed receive attention buffer  }
  143.             localSocket:        UInt8;                                    {  local socket number  }
  144.             filler1:            UInt8;                                    {  filler for proper byte alignment  }
  145.            );
  146.         1: (
  147.             localCID:            UInt16;                                    {  local connection id  }
  148.             remoteCID:            UInt16;                                    {  remote connection id  }
  149.             remoteAddress:        AddrBlock;                                {  address of remote end  }
  150.             filterAddress:        AddrBlock;                                {  address filter  }
  151.             sendSeq:            UInt32;                                    {  local send sequence number  }
  152.             sendWindow:            UInt16;                                    {  send window size  }
  153.             recvSeq:            UInt32;                                    {  receive sequence number  }
  154.             attnSendSeq:        UInt32;                                    {  attention send sequence number  }
  155.             attnRecvSeq:        UInt32;                                    {  attention receive sequence number  }
  156.             ocMode:                UInt8;                                    {  open connection mode  }
  157.             ocInterval:            UInt8;                                    {  open connection request retry interval  }
  158.             ocMaximum:            UInt8;                                    {  open connection request retry maximum  }
  159.             filler2:            UInt8;                                    {  filler for proper byte alignment  }
  160.            );
  161.         2: (
  162.             abort:                UInt8;                                    {  abort connection immediately if non-zero  }
  163.             filler3:            UInt8;                                    {  filler for proper byte alignment  }
  164.            );
  165.         3: (
  166.             reqCount:            UInt16;                                    {  requested number of bytes  }
  167.             actCount:            UInt16;                                    {  actual number of bytes  }
  168.             dataPtr:            Ptr;                                    {  pointer to data buffer  }
  169.             eom:                UInt8;                                    {  indicates logical end of message  }
  170.             flush:                UInt8;                                    {  send data now  }
  171.            );
  172.         4: (
  173.             attnCode:            UInt16;                                    {  client attention code  }
  174.             attnSize:            UInt16;                                    {  size of attention data  }
  175.             attnData:            Ptr;                                    {  pointer to attention data  }
  176.             attnInterval:        UInt8;                                    {  retransmit timer in 10-tick intervals  }
  177.             filler4:            UInt8;                                    {  filler for proper byte alignment  }
  178.            );
  179.         5: (
  180.             statusCCB:            TPCCB;                                    {  pointer to ccb  }
  181.             sendQPending:        UInt16;                                    {  pending bytes in send queue  }
  182.             sendQFree:            UInt16;                                    {  available buffer space in send queue  }
  183.             recvQPending:        UInt16;                                    {  pending bytes in receive queue  }
  184.             recvQFree:            UInt16;                                    {  available buffer space in receive queue  }
  185.            );
  186.         6: (
  187.             sendBlocking:        UInt16;                                    {  quantum for data packets  }
  188.             sendTimer:            UInt8;                                    {  send timer in 10-tick intervals  }
  189.             rtmtTimer:            UInt8;                                    {  retransmit timer in 10-tick intervals  }
  190.             badSeqMax:            UInt8;                                    {  threshold for sending retransmit advice  }
  191.             useCheckSum:        UInt8;                                    {  use ddp packet checksum  }
  192.            );
  193.         7: (
  194.             newcid:                UInt16;                                    {  new connection id returned  }
  195.            );
  196.     END;
  197.  
  198.     DSPPBPtr                            = ^DSPParamBlock;
  199.  
  200. CONST
  201.     uppADSPConnectionEventProcInfo = $0000B802;
  202.     uppADSPCompletionProcInfo = $00009802;
  203.  
  204. FUNCTION NewADSPConnectionEventProc(userRoutine: ADSPConnectionEventProcPtr): ADSPConnectionEventUPP;
  205.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  206.     INLINE $2E9F;
  207.     {$ENDC}
  208.  
  209. FUNCTION NewADSPCompletionProc(userRoutine: ADSPCompletionProcPtr): ADSPCompletionUPP;
  210.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  211.     INLINE $2E9F;
  212.     {$ENDC}
  213.  
  214. PROCEDURE CallADSPConnectionEventProc(sourceCCB: TPCCB; userRoutine: ADSPConnectionEventUPP);
  215.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  216.     {To be implemented:  Glue to move parameters into registers.}
  217.     {$ENDC}
  218.  
  219. PROCEDURE CallADSPCompletionProc(thePBPtr: DSPPBPtr; userRoutine: ADSPCompletionUPP);
  220.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  221.     {To be implemented:  Glue to move parameters into registers.}
  222.     {$ENDC}
  223.  
  224. {$ALIGN RESET}
  225. {$POP}
  226.  
  227. {$SETC UsingIncludes := ADSPIncludes}
  228.  
  229. {$ENDC} {__ADSP__}
  230.  
  231. {$IFC NOT UsingIncludes}
  232.  END.
  233. {$ENDC}
  234.